package com.example.fishscavengerhunt;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.Gallery;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;

public class NewGame extends Activity {

	Gallery gallery;
	ImageView imageView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_new_game);
		gallery = (Gallery) findViewById(R.id.gallery1);
		imageView = (ImageView) findViewById(R.id.imageView1);
		gallery.setAdapter(new ImageAdapter(this));

		gallery.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> adapter, View arg1,
					int position, long arg3) {
				// TODO Auto-generated method stub
				// Toast.makeText(getApplicationContext(), position+"",
				// Toast.LENGTH_SHORT).show();
				imageView.setImageResource(ImageAdapter.ThumbsIds[position]);
			}

		});
		final Button playButton = (Button) findViewById(R.id.play);
		playButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				Intent myIntent = new Intent(NewGame.this, NewRiverScout.class);
				NewGame.this.startActivity(myIntent);
			}
		});
		((ImageButton) findViewById(R.id.back))
				.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {
						finish();
					}
				});
		((ImageButton) findViewById(R.id.home))
		.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent newIntent = new Intent(NewGame.this, Main.class);
            	NewGame.this.startActivity(newIntent);
            	finish();
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.new_game, menu);
		return true;
	}

}
